#pragma once
#ifndef __COMMON_HPP__
#define __COMMON_HPP__
#endif

#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

enum
{
    OK = 0,
    UsageError,
    PipeError,
    ForkError
};

const std::string gpipeFile = "./fifo |";
const mode_t gmode = 0600;
const int gdefaultfd = -1;
const int gForRead = O_RDONLY;
const int gForWrite = O_WRONLY;
const int gsize = 1024;
int OpenPipeHelper(int flag)
{
    int fd = ::open(gpipeFile.c_str(), flag);
    if (fd < 0)
    {
        std::cerr << "open error" << std::endl;
        return -1;
    }
    return fd;
}

